package com.example.fj2889.yuedongplayer;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import java.security.PublicKey;
import java.util.List;

/**
 * Created by fj2889 on 2017/6/19.
 */
public class MusicAdapter extends ArrayAdapter<Music>{
    private int resourceId;

    public MusicAdapter(Context context,int textViwResourceId,List<Music> objects){
        super(context,textViwResourceId,objects);
        resourceId=textViwResourceId;
    }
    @Override
    public View getView(int position, View convertView, ViewGroup parent){
        Music music=getItem(position);
        View view= LayoutInflater.from(getContext()).inflate(resourceId,null);
        TextView musicName=(TextView)view.findViewById(R.id.music_name);
        musicName.setText(music.getName());
        return view;
    }
}
